package com.carb.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.carb.enums.CommonDeleted;
import com.carb.enums.MemberLevel;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 会员实体类
 * </p>
 *
 * @author XuChaoyang
 * @since 2025-01-18
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("tb_member")
@Schema(description = "会员表")
public class Member implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(description = "会员id")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @Schema(description = "用户id")
    private Long userId;

    @Schema(description = "会员等级 (普通, 银卡, 金卡, 至尊)")
    private MemberLevel level;

    @Schema(description = "会员积分")
    private Integer points;

    @Schema(description = "账户余额 (单位为分)")
    private Integer balance;

    @Schema(description = "服务总次数")
    private Integer totalServicesCount;

    @Schema(description = "上次服务时间")
    private LocalDateTime lastServiceTime;

    @Schema(description = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @Schema(description = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    @Schema(description = "逻辑删除 (未删除, 已删除)")
    private CommonDeleted deleted;

}
